package com.aaa.service.mht.impl;

import com.aaa.dao.mht.TmhtRecordMapper;
import com.aaa.entity.MyPage;
import com.aaa.entity.TmhtRecord;
import com.aaa.entity.mht.TjMessage;
import com.aaa.entity.mht.Ttongji;
import com.aaa.service.mht.TmhtRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * (TmhtRecord)表服务实现类
 *
 * @author yuyongli
 * @since 2022-10-25 15:46:19
 */
@Service
public class TmhtRecordServiceImpl implements TmhtRecordService {
   @Autowired
   private TmhtRecordMapper tmhtRecordMapper;

    @Override
    public TmhtRecord checkrecord(TmhtRecord record) {
        TmhtRecord tmhtRecord = tmhtRecordMapper.selectOne(record);
        return tmhtRecord;
    }

    @Override
    public int insertRecord(TmhtRecord record) {
        record.setCreatetime(new Date());
        int i = tmhtRecordMapper.insert(record);
        System.out.println(record.getId());
        return record.getId();
    }

    @Override
    public List<Ttongji> getTjData() {

        return tmhtRecordMapper.getTjData();
    }

    @Override
    public PageInfo getTjData2(MyPage myPage, TjMessage tjMessage) {
        PageHelper.startPage(myPage.getPage(),myPage.getLimit());

        return new PageInfo(tmhtRecordMapper.getTjData2(tjMessage));
    }
}

